<style>
body {
	margin: 0 auto;
	width: 70%;
	font: 100% Georgia, "Times New Roman", Times, serif;
}
h2 {
	color:red;
	font-weight: normal;
}
table { 
	border-collapse: collapse; 
	border: none; 
	width: 400px; 
} 
td { 
	border: solid #000000 1px;
	width: 100px; 
} 
</style>
<table><tr><td>CDIR</td><td>ASN</td><td>ASN Whois</td></tr>
<?php
include 'conn.php';
$sql = "SELECT cdir FROM BGP_cdir;";
$result=$conn->query($sql);
while ($row = mysqli_fetch_assoc($result))
{
	$url="http://103.248.66.253/api.php?ip={$row['cdir']}"; 
	$html = file_get_contents($url);
	if (!empty($html)) {
		$arr = explode(" ",$html); 
		$CDIR=reset($arr);
		$ASN=end($arr);
		echo "<tr><td><a href=http://bgp.he.net/net/{$CDIR} target=_black>{$CDIR}</a></td>
		<td><a href=http://bgp.he.net/AS{$ASN} target=_black>{$ASN}</a></td>
		<td><a href=http://bgp.he.net/AS{$ASN}#_whois target=_black>Whois</a></td></tr>";
	}
    ob_flush();
    flush();
}
$conn->close();
?>
</table>